<%--
  Created by IntelliJ IDEA.
  User: 三斤
  Date: 2022/11/28
  Time: 19:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录投票</title>
</head>
<body>
<jsp:useBean id="DB" class="db.conn" />
<h2>请投票:</h2>
<table border bordercolor="#0099ff">
    <tr>
        <th bgcolor="#CCFFFF">编号-人物</th>

    </tr>
    <form action="vote1.jsp" method="post">
        <%
            Connection conn = DB.getConn();
            Statement stmt = DB.getStatement(conn);
            ResultSet rs = DB.getResultSet(stmt,"select * from vote1");
            while(rs.next()){
                out.println("<tr>");
                out.println("<td><input type='radio' name='id' value='"+rs.getString("id")+"'>");
                out.println(rs.getString("id")+rs.getString("item")+"</td>");
                out.println("</tr>");
            }
            DB.close(conn);
            DB.close(stmt);
            DB.close(rs);
            session.setMaxInactiveInterval(-1);
        %>
        <tr><td><input type="submit" value="投票"></td></tr>
    </form>
</table>
</body>
</html>